package com.aaa.javaweb.dao.impl;

import com.aaa.javaweb.dao.UpdOrderDao;
import com.aaa.javaweb.entity.TOrder;
import com.aaa.javaweb.until.BaseDB;
import com.aaa.javaweb.until.JDBCUntil;
import org.springframework.stereotype.Repository;

@Repository
public class UpdOrderDaoImpl implements UpdOrderDao {
    @Override
    public void getDate(TOrder order) {
        String sql="{call create_calendar('"+order.getRzdate()+"','"+order.getLeavedate()+"')}";
        BaseDB.getCall(sql);
    }

    @Override
    public int addOrder(TOrder order) {
        String sql ="insert into t_order (createtime,price,uid,name,tel,roomtype,count,rzdate,leavedate) values(now(),?,1,?,?,?,?,?,?)";
        return JDBCUntil.Updateout(sql,order.getPrice(),order.getName(),order.getTel(),order.getRoomtype(),order.getCount(),order.getRzdate(),order.getLeavedate());
    }
}
